﻿<UserControl x:Class="cmdr.Editor.Views.ConditionsEditor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:controls="clr-namespace:cmdr.Editor.Views.Controls"
             xmlns:ddButton="clr-namespace:cmdr.WpfControls.DropDownButton;assembly=cmdr.WpfControls"
             xmlns:cond="clr-namespace:cmdr.TsiLib.Conditions;assembly=cmdr.TsiLib"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="400">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="boolToVisConverter"/>
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="5"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="35"/>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <ddButton:DropDownButton Grid.Row="0" Grid.Column="0" Height="30" Width="30" 
                                 VerticalAlignment="Center" HorizontalAlignment="Left"
                                 MenuPlacement="Right" ItemsSource="{Binding Conditions, Mode=OneTime}"
                                 Command="{Binding SetCondition1Command, Mode=OneTime}" Margin="0,5,0,0">
            <Button.Content>
                <Image Source="../Assets/flaticons/number-one-in-a-circle.png" RenderOptions.BitmapScalingMode="HighQuality"/>
            </Button.Content>
        </ddButton:DropDownButton>
        <controls:ConditionControl  Grid.Row="0" Grid.Column="1" DataContext="{Binding Condition1}">
            <controls:ConditionControl.Style>
                <Style TargetType="{x:Type controls:ConditionControl}">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Condition}" Value="{x:Null}">
                            <Setter Property="Visibility" Value="Hidden"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </controls:ConditionControl.Style>
        </controls:ConditionControl>
        <TextBlock Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Text="Various Conditions" Visibility="{Binding Condition1Various, Converter={StaticResource boolToVisConverter}}"/>

        <ddButton:DropDownButton Grid.Row="2" Grid.Column="0" Height="30" Width="30" 
                                 VerticalAlignment="Center" HorizontalAlignment="Left"
                                 MenuPlacement="Right" ItemsSource="{Binding Conditions, Mode=OneTime}"
                                 Command="{Binding SetCondition2Command, Mode=OneTime}" Margin="0,5,0,0">
            <Button.Content>
                <Image Source="../Assets/flaticons/number-two-in-a-circle.png" RenderOptions.BitmapScalingMode="HighQuality"/>
            </Button.Content>
        </ddButton:DropDownButton>
        <controls:ConditionControl  Grid.Row="2" Grid.Column="1" DataContext="{Binding Condition2}">
            <controls:ConditionControl.Style>
                <Style TargetType="{x:Type controls:ConditionControl}">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Condition}" Value="{x:Null}">
                            <Setter Property="Visibility" Value="Hidden"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </controls:ConditionControl.Style>
        </controls:ConditionControl>
        <TextBlock Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Text="Various Conditions" Visibility="{Binding Condition2Various, Converter={StaticResource boolToVisConverter}}"/>
    </Grid>
</UserControl>
